import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/views/Home.vue'
import Login from '@/views/Login.vue'
import MainPage from '@/views/MainPage.vue'
import DetailPage from '@/views/DetailPage.vue'
import Order from '@/views/Order.vue'
import Purchase from '@/views/Purchase.vue'
import Register from '@/views/Register.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect: '/main',
    children: [
        {
          path:'main',
          component: MainPage
        },
      {
        path: 'detail',
        component: DetailPage
      },
      {
        path: 'order',
        component: Order
      },
      {
        path: 'purchase',
        component: Purchase
      },
      {
        path: 'register',
        component: Register
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
